
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
ALTER PROCEDURE sp_DeleteWholeCourse
	-- Add the parameters for the stored procedure here
	@MainID int,
	@Output int output
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select @Output = 0

	Begin Transaction
		Delete from tblSubTraining Where TR_MainCatID = @MainID
		Delete from tblMainTraining Where TR_MainCatID = @MainID
		select @Output = 1

	if @@Error > 1 
		Rollback Transaction
	else
		Commit Transaction

	return @Output
END
GO
